<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        var cities = ["北京","上海","成都","山西"];// 注意：数组的声明形式也和 Java 有所不同~
        document.write("<ul>");
            for(var city in cities) {
                document.write("<li>" + cities[city] + "</li>");
            }
        document.write("</ul>");
    </script>
</head>
<body>
    
</body>
</html>